{% extends "global/Page.html" %}
{% load otree static %}

{% block title %}
    结果
{% endblock %}
{% block content %}
    <div>
        您的组别是：
        {% if player.id_in_subsession == player.session.vars.r1 or player.id_in_subsession == player.session.vars.r2 or player.id_in_subsession == player.session.vars.r3 or player.id_in_subsession == player.session.vars.r4 or player.id_in_subsession == player.session.vars.r5 or player.id_in_subsession == player.session.vars.r6 %}
            <span style="color: red">红组</span>
        {% endif %}
        {% if player.id_in_subsession == player.session.vars.b1 or player.id_in_subsession == player.session.vars.b2 or player.id_in_subsession == player.session.vars.b3 or player.id_in_subsession == player.session.vars.b4 or player.id_in_subsession == player.session.vars.b5 or player.id_in_subsession == player.session.vars.b6 %}
            <span style="color: blue">蓝组</span>
        {% endif %}
        {% if player.id_in_subsession == player.session.vars.g1 or player.id_in_subsession == player.session.vars.g2 or player.id_in_subsession == player.session.vars.g3 or player.id_in_subsession == player.session.vars.g4 or player.id_in_subsession == player.session.vars.g5 or player.id_in_subsession == player.session.vars.g6 %}
            <span style="color: green">绿组</span>
        {% endif %}
        <br>
    </div>
    <div>
        <p>本轮你做对的题数：{{ player.right2 }}</p>
        <p>本轮你为团队争取到的游戏币： {{ player.point2 }}</p>
        <p>你们团队累计获得的游戏币：
            {% if player.id_in_subsession == player.session.vars.r1 or player.id_in_subsession == player.session.vars.r2 or player.id_in_subsession == player.session.vars.r3 or player.id_in_subsession == player.session.vars.r4 or player.id_in_subsession == player.session.vars.r5 or player.id_in_subsession == player.session.vars.r6 %}
                {{ group.session.vars.A_CalculateGamePoint }}
            {% endif %}
            {% if player.id_in_subsession == player.session.vars.b1 or player.id_in_subsession == player.session.vars.b2 or player.id_in_subsession == player.session.vars.b3 or player.id_in_subsession == player.session.vars.b4 or player.id_in_subsession == player.session.vars.b5 or player.id_in_subsession == player.session.vars.b6 %}
                {{ group.session.vars.B_CalculateGamePoint }}
            {% endif %}
            {% if player.id_in_subsession == player.session.vars.g1 or player.id_in_subsession == player.session.vars.g2 or player.id_in_subsession == player.session.vars.g3 or player.id_in_subsession == player.session.vars.g4 or player.id_in_subsession == player.session.vars.g5 or player.id_in_subsession == player.session.vars.g6 %}
                {{ group.session.vars.C_CalculateGamePoint }}
            {% endif %}
        </p>
        <p>平分后您获得的游戏币: {{ player.participant.vars.total_payoff }}</p>
        <div style="text-align: center; border: black; width: 240px; border-style:solid;
    border-width:medium;">
            <p style="font-size: 20px">团队积分榜</p>
            {#    A B C 红蓝绿#}
            {#        A>B>C A>C>B B>A>C B>C>A C>A>B C>B>A 1.5 1.0 0.9#}
            {#        A=B>C A=C>B B=C>A 1.5 1.5 0.9#}
            {#        A>B=C B>A=C C>A=B 1.5 1.0 1.0#}
            {#        A=B=C 1.5 1.5 1.5#}
            {#        #}
            {#    无论怎样 第一名都是1.5#}
            {#    如果 第一名和第二名相等 第二名是1.5 否则第二名是1.0#}
            {#    如果第二名和第三名相等 第三名是1.5（三个都相等）#}
            {#    如果第三名等于第三名 那么第三名是1.0 否则第三名是0.9#}
            {% if group.session.vars.A_CalculateGamePoint == group.session.vars.B_CalculateGamePoint and group.session.vars.B_CalculateGamePoint == group.session.vars.C_CalculateGamePoint %}
                <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×1.5个</p>
                <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×1.5个</p>
                <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×1.5个</p>
            {% elif group.session.vars.A_CalculateGamePoint >= group.session.vars.B_CalculateGamePoint and group.session.vars.A_CalculateGamePoint >= group.session.vars.C_CalculateGamePoint %}
                <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×1.5个</p>
                {#         已知A最大  先求出B和C谁更大#}
                {% if group.session.vars.B_CalculateGamePoint == group.session.vars.C_CalculateGamePoint %}
                    {#                B和C一样大 此时A肯定比B和C大 B和C都是1.0#}
                    <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×1.0个</p>
                    <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×1.0个</p>
                    {#                此时还有可能是A和B 或A和C一样大 此时为1.5 1.5 0.9 #}
                {% elif group.session.vars.A_CalculateGamePoint == group.session.vars.B_CalculateGamePoint %}
                    {# A=B>C 1.5 1.5 0.9#}
                    <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×1.5个</p>
                    <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×0.9个</p>
                {% elif group.session.vars.A_CalculateGamePoint == group.session.vars.C_CalculateGamePoint %}
                    {# A=C>B 1.5 1.5 0.9#}
                    <p><span style="color: blue">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×1.5个</p>
                    <p><span style="color: green">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×0.9个</p>
                    {# 否则就是正常的A>B>C或A>C>B 正常排名 #}
                {% elif group.session.vars.B_CalculateGamePoint > group.session.vars.C_CalculateGamePoint %}
                    <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×1.0个</p>
                    <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×0.9个</p>
                {% else %}
                    <p><span style="color: blue">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×1.0个</p>
                    <p><span style="color: green">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×0.9个</p>
                {% endif %}
                {#            B最大#}
            {% elif group.session.vars.B_CalculateGamePoint >= group.session.vars.A_CalculateGamePoint and group.session.vars.B_CalculateGamePoint >= group.session.vars.C_CalculateGamePoint %}
                <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×1.5个</p>
                {% if group.session.vars.A_CalculateGamePoint == group.session.vars.C_CalculateGamePoint %}
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×1.0个</p>
                    <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×1.0个</p>
                    {#                此时还有可能是A和B 或A和C一样大 此时为1.5 1.5 0.9 #}
                {% elif group.session.vars.B_CalculateGamePoint == group.session.vars.A_CalculateGamePoint %}
                    {# A=B>C 1.5 1.5 0.9#}
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×1.5个</p>
                    <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×0.9个</p>
                {% elif group.session.vars.B_CalculateGamePoint == group.session.vars.C_CalculateGamePoint %}
                    {# A=C>B 1.5 1.5 0.9#}
                    <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×1.5个</p>
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×0.9个</p>
                    {# 否则就是正常的A>B>C或A>C>B 正常排名 #}
                {% elif group.session.vars.A_CalculateGamePoint > group.session.vars.C_CalculateGamePoint %}
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×1.0个</p>
                    <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×0.9个</p>
                {% else %}
                    <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×1.0个</p>
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×0.9个</p>
                {% endif %}
            {% elif group.session.vars.C_CalculateGamePoint >= group.session.vars.A_CalculateGamePoint and group.session.vars.C_CalculateGamePoint >= group.session.vars.B_CalculateGamePoint %}
                <p><span style="color: green">绿组</span>获得的游戏币：{{ group.session.vars.C_CalculateGamePoint }}×1.5个</p>
                {% if group.session.vars.A_CalculateGamePoint == group.session.vars.B_CalculateGamePoint %}
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×1.0个</p>
                    <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×1.0个</p>
                {% elif group.session.vars.C_CalculateGamePoint == group.session.vars.A_CalculateGamePoint %}
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×1.5个</p>
                    <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×0.9个</p>
                {% elif group.session.vars.C_CalculateGamePoint == group.session.vars.B_CalculateGamePoint %}
                    <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×1.5个</p>
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×0.9个</p>
                {% elif group.session.vars.A_CalculateGamePoint > group.session.vars.B_CalculateGamePoint %}
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×1.0个</p>
                    <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×0.9个</p>
                {% else %}
                    <p><span style="color: blue">蓝组</span>获得的游戏币：{{ group.session.vars.B_CalculateGamePoint }}×1.0个</p>
                    <p><span style="color: red">红组</span>获得的游戏币：{{ group.session.vars.A_CalculateGamePoint }}×0.9个</p>
                {% endif %}
            {% endif %}
        </div>
    </div>
{% endblock %}
。

